<?php
namespace app\index\controller;

use think\Controller;

class Index extends Controller
{
    public function index()
    {
//        dump(\think\facade\Env::get('database.hostname'));die1111;
        $banner = db("banner")->select();
        $this->assign("banner",$banner);
        $banner_menu = db("banner_menu")->select();
        $this->assign("banner_menu",$banner_menu);
        $title = db("title")->where("pid",0)->select();
        $this->assign("title",$title);
        $this->assign("action","index");
        return view("index");
    }
//    关于我们
    public function about(){
        return view("about");
    }
    public function title(){
        $id = input("id");
        if($id == 1){
            $banner = db("banner")->select();
            $this->assign("banner",$banner);
            $banner_menu = db("banner_menu")->select();
            $this->assign("banner_menu",$banner_menu);
            $title = db("title")->select();
            $this->assign("title",$title);
            $this->assign("id",$id);
            return view("index");
        }
        if($id == 2){
            $title = db("title")->select();
            $this->assign("title",$title);
            $this->assign("id",$id);
            $this_title = db("title")->where("id",$id)->find();
            $this->assign("this_title",$this_title);
            $about = db("about")->select();
//            dump($about);
            $this->assign("about",$about);
            $about_menu = db("about_menu")->select();
            $this->assign("about_menu",$about_menu);
            return view("about");
        }
    }

}
